Completed
Push — master ( ff6124...8caa6f )
by Jan
23s queued 12s
created

id3-data.ts ➔ createId3Data   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 10
rs 9.9
c 0
b 0
f 0
cc 1
1
import { encodeSize } from "./ID3Util"
2
3
export function createId3Data(frames: Buffer) {
4
    const header = Buffer.alloc(10)
5
    header.fill(0)
6
    header.write("ID3", 0)              // File identifier
7
    header.writeUInt16BE(0x0300, 3)     // Version 2.3.0  --  03 00
8
    header.writeUInt16BE(0x0000, 5)     // Flags 00
9
    encodeSize(frames.length).copy(header, 6)
10
11
    return Buffer.concat([header, frames])
12
}
13